<?php
	$html->addCrumb('Manager','/manager/');
	$html->addCrumb('Kurs verwalten','/manager/courses/');
	
	echo  $this->element('tasks',array('target'=>'/manager/courses'));
?>
<div class="title">Kurse verwalten</div>

<?php 
echo $this->element('flashMessage');

echo $this->Form->create();
?>

<table>
	<tr>
		<td style="border:none"><input type="text" name="find_course_name" value="<?php echo $this->params['form']['find_course_name'] ?>"></td>
		<td style="border:none"><input type="text" name="find_professor_name" value="<?php echo $this->params['form']['find_professor_name'] ?>"></td>
		<td style="border:none"  colspan="3"><input type="submit" value="Filtern"><a href="<?php echo $this->here ?>"><button>Reset Filter</button></a></td>
	</tr>
	<tr>
		<th>Kurs</th>
		<th>Dozent</th>
		<th>Spezialisierung</th>
		<th>Profil</th>
		<th>Richtung</th>
		<th>Aktion</th>
	</tr>
	<?php
	$out = '';
	foreach($this->data as $key => $value){
		$out .='<tr>';
			$out .='<td>';
			$out .= $value['Course']['course_name'];
			$out .='</td>';
			$out .='<td>';
			$out .= $value['Professor']['full_name'];
			$out .='</td>';
			$out .='<td>';
			$out .= $value['CourseSpecialisation']['specialisation_name'];
			$out .='</td>';
			$out .='<td>';
			$out .= $value['Profile']['profile_name'];
			$out .='</td>';
			$out .='<td>';
			$out .= $value['StudyBranch']['branch_name'];
			$out .='</td>';
			$out .='<td>';
			
			// changed
			$out .= $this->Html->link('Ändern',array('action'=>'update',$value['Course']['id']));
			$out .= ' '.$this->Html->link('Löschen',array('action'=>'delete',$value['Course']['id']));
			//$out .=' <a href="'.URL_PREFIX.'/manager/courses/update/'.$value['Course']['id'].'"><button>Ändern</button></a>';
			//$out .=' <a href="'.URL_PREFIX.'/manager/courses/delete/'.$value['Course']['id'].'"><button>Löschen</button></a>';
			$out .='</td>';
		$out .='</tr>';
	}
	echo $out;
	?>
</table>

<?php echo $this->Form->end() ?>

